﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Admin.ViewModels.ProviderViewModels>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<%@ Import Namespace="SDT.Admin.ViewModels" %>
<%@ Import Namespace="SDT.Model"%>
<%@ Import Namespace="SDT.Lib.Paging" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Danh sách công ty cung cấp
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">	
	<%= Html.Toolbar("Thêm mới", "/Provider/Create", "new")%>	
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="Header" runat="server">
	Danh sách công ty cung cấp
</asp:Content>

<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["Message"] != null ? "<p class='perror'>" + Html.Encode(ViewData["Message"]) + "</p>" : string.Empty%>  
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script src="/Scripts/ams.js" type="text/javascript"></script>
    <form action="/Provider/Index" method="post" name="providerForm">    
    <table>
        <tr>            
            <td><%=Html.TextBoxFor(m=>m.Keyword) %>&nbsp;&nbsp;<input id="btnSearch" type="submit" value="Tìm kiếm" /></td> 
                
        </tr>
    </table>
   
<table style="border:none; font-weight: bold;" width="100%">
    <tbody>
        <tr>
			<td style="border:none;text-align: left">Tổng số nhà cung cấp: <%= Model.Providers.TotalItemCount %></td>
			<td style="border:none;text-align: right;">Trang hiện tại: <%= Model.Providers.PageCount > 0 ? Model.Providers.PageIndex + 1 : 0%>/<%= Model.Providers.PageCount%></td>
        </tr>
    </tbody>
</table>
<table style="width:100%" class="adminlist">
    <tr>
        <th style="text-align:center; width:3%">STT</th>
        <th width="30"></th>
		<th width="30"></th>
        <th style="width:30%">Tên nhà cung cấp</th>
        <th style="width:25%">Địa chỉ</th>
        <th style="width:15%">Số điện thoại</th>
        <th style="width:18%">Email</th>
        
    </tr>
    <%int index = Model.Providers.PageIndex * Model.Providers.PageSize + 1;
      foreach (var item in Model.Providers)
      { %>
        <tr>
            <td style="text-align:center;"><%=index++ %></td>
            <td align="center">
				<%= Html.ActionImage("Sửa", "icon-24-edit.png", "Provider", "Edit", new Dictionary<string, object>() { { "id", item.ID } })%>
			</td>
			 <td align="center">
				<%= Html.ActionImage("Xóa", "icon-24-delete.png", "Provider", "Delete", new Dictionary<string, object>() { { "id", item.ID } })%>
			</td>
            <td>
                <%=Html.ActionLink(item.Name, "Edit", new { id = item.ID })%>
            </td>
            <td><%=Html.Encode(item.Address) %></td>
            <td><%=Html.Encode(item.Phone) %></td>
            <td><%=item.Email %></td>            
        </tr>
     <% } %>     
</table>
<table width="100%">
    <tr>
            <td align="center" class="pager">
                    <label>Hiển thị #</label>
                    <%
                        int[] pageSizeList = {5, 10, 15, 20, 25, 50, 100};
                    %>
                    <%= Html.DropDownList("pageSize", new SelectList(pageSizeList, Model.Providers.PageSize), new { onchange = "document.providerForm.submit();" })%>
                    <%= Html.Pager(Model.Providers.PageSize, Model.Providers.PageNumber, Model.Providers.TotalItemCount, new { pageSize = Model.Providers.PageSize, key = Model.Keyword })%>
            </td>
        </tr>
</table>
</form>

</asp:Content>
